package com.wlyuan.index.domain.index.repository.old;

import com.wlyuan.core.domain.valueobj.CombineId;
import lombok.var;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

import java.util.List;

public interface CombineIndexOldRepository extends ElasticsearchRepository<CombineIndexOld, Long> {

    List<CombineIndexOld> findByCombineId(Long combineId);

    default List<CombineIndexOld> list(CombineId combineId) {
        return this.findByCombineId(combineId.getId());
    }

    default Page<CombineIndexOld> list(int page, int size) {
        var pageable = Pageable.ofSize(size).withPage(page);
        return this.findAll(pageable);
    }
}